//导入vue
import Vue from 'vue'
//导入app组件
import App from './App'
//导入uview组件
import uView from '@/uni_modules/uview-ui'
//导入公共类
import app from "./common/common.js";
// 导入公共网络请求
import {request} from './common/request.js'
// 注入请求实例
app.setRequestInstance(request)

// #ifndef VUE3
import './uni.promisify.adaptor'

//配置uview
Vue.use(uView)
uni.$u.config.unit = 'rpx'

// 挂载全局对象
Vue.prototype.$http = request;
Vue.prototype.$app = app;

Vue.config.productionTip = false
App.mpType = 'app'
const vueApp = new Vue({
	...App
})
vueApp.$mount()
// #endif

// #ifdef VUE3
import { createSSRApp } from 'vue'
import { request } from '@/common/request.js'
import app from '@/common/common.js'

export function createApp() {
  const appInstance = createSSRApp(App)
  
  // 全局属性挂载
  appInstance.config.globalProperties.$http = request
  appInstance.config.globalProperties.$app = app

  return {
    app: appInstance
  }
}
// #endif